This page last changed on Sep 22, 2004 by scytacki.

Here are the current steps to make a vanilla sync4j server able to handle the portfolio.
This is only using the pdi sync source that comes with sync4j. probably we'll need our own sync source when we have thousands of objects to manage.

  1. install the standalone server, I think this is just a zip file that you uncompress in the correct place
  2. startup the server, so you can access the hsqldb database.

at this point you could follow the sync4j tutorial instructions and use the sync4j admin tool. But then you won't know how this is working underneath, and I've found that that tool is difficult to get right. So it is better to do things by hand. Perhaps you'll have better luck.

  1. you now need to modified an hsqldb database which is used to track the sync sources and last syncs and all of that. I believe you can do this without starting up the server if you know which db file to point the hsqldb driver at. I've use the DatabaseManager awt application that comes with the hsqldb.jar in the sync4j standalone. you can run that like:
    java -cp hsqldb.jar org.hsqldb.util.DatabaseManager
    note I think you'll need the same version of hsqldb that is being used by the server. Currently this is 1.6. I've tried a gui admin tool that used hsqldb 1.7.2 but that didn't seem to work.
  2. run the following sql: INSERT INTO SYNC4J_SYNC_SOURCE values('./portfolio','pdi-1.2/pdi-1.2/fs-pdi-1.2/portfolio.xml','portfolio','fs-pdi-1.2')
  3. put the portfolio.xml (attached) file in SyncServer/syncserver-4.0.4/config/pdi-1.2/pdi-1.2/fs-pdi-1.2
  4. make a folder called portfolio at SyncServer/syncserver-4.0.4/db (I believe this is defined in the portfolio.xml)
  5. chmod the portfolio folder you just created so the world can write to it.
  6. restart the server
  7. check the SyncServer/syncserver-4.0.4/config/Sync4j.properties it should have the correct server uri in it. If you are proxying to the server from a different machine this should be the outside address of the server. This address is used by the client after the initial request. It should include the "sync" within the server address so for example it should be:
    server.uri=http://dev.concord.org/teemss2-sync4j/sync
  1. for each device that you want to sync there must be an entry in the SYNC4J_DEVICE table and an entry in the SYNC4J_PRICIPAL table. A device can be added with:
    INSERT INTO SYNC4J_DEVICE VALUES('sc3','added using hsql db manager','J2SE','','','','sync4j')
    replace sc3 with the device name
    then the last id of the PRINCIPAL table must be retrieved and updated
    retrieve the counter
    SELECT COUNTER FROM SYNC4J_ID WHERE IDSPACE='principal'
    increment it
    if the database supports (hsqldb does not) "FOR UPDATE" can be added to the end. This will lock the row until the update is called. Another way to handle this is to use the LAST_INSERT_ID() method. Or better would be to use an auto increment id, (which hsqldb supports). but this would probably break the sync4j code.
    UPDATE SYNC4J_ID SET COUNTER=16 WHERE IDSPACE='principal'
    and then the a new principal must be added:
    INSERT INTO SYNC4J_PRINCIPAL VALUES('guest','sc3',16)
    replace sc3 with the device name and 16 with the last principal id

portfolio.xml (text/xml)
Document generated by Confluence on Jan 27, 2014 16:43